package com.bkgy.controller.runtrack.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bkgy.controller.runtrack.dao.RunTrackDao;
import com.bkgy.controller.runtrack.entity.RunTrack;
import com.bkgy.controller.runtrack.entity.RunTrackRequest;
import com.bkgy.controller.runtrack.service.RunTrackService;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 酸扎计划仿真服务实现类
 */
@Service
public class RunTrackServiceImpl implements RunTrackService {
    @Autowired
    private RunTrackDao runTrackDao;

    @Override
    public ResultData getRunTrackData(RunTrackRequest request) {
        try {
            Page<?> page = new Page<>(request.getPageIndex(), request.getPageSize());
            List<RunTrack> list = runTrackDao.getRunTrackData(page,request);
            Integer count = runTrackDao.getRunTrackDataCount(request);
            return ResultData.ResultDataSuccess(list, count);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }
}
